<?php
namespace app\index\model;
use think\Model;
$origin = $_SERVER['HTTP_ORIGIN'];
$allowed_domains = [
	'https://edgexie.gitee.io',
	'http://localhost:8080'
];
if (in_array($origin, $allowed_domains)) {
    header('Access-Control-Allow-Origin: ' . $origin);
}
header('Access-Control-Allow-Headers:content-type'); 
header('Content-Type: application/json');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Methods: GET, POST, PUT');

class Visit extends Model {
	public function setVisit($arr) {
		$pageView = $this::create($arr, true)->id;
		$count = $this::count();
		if ($pageView) {
			return ['code' => 200, 'message' => $count];
		} else {
			return ['code' => 200, 'message' => 'failed'];
		};
	}
}

?>